﻿/*
 * IGeometryConverter
 * 
 * initial implementation : 20.10.2008
 *
 * Copyright (c) Adam Sida, asida@centrum.cz.
 * All rights reserved.
 * 
 * for license see Petra.Gis.License.txt
 */
using System;
//using System.Collections.Generic;
using Petra.Gis.Geometry;

namespace Petra.Gis.DataServices
{
  /// <summary>
  /// helper interface, when implemented provides functionality
  /// that can convert elements within IEnumerable collection into
  /// GeometryBase
  /// </summary>
  public interface IGeometryConverter : IGeometryFactory
  {


    /// <summary>
    /// when geometry is not available directly from IEnumerable, but is saved is structure for example,
    /// this function returns geometry data by given geometry field name
    /// </summary>
    /// <param name="dataItem">item from IEnumerable collection</param>
    /// <param name="geometryFieldName">name of geometry/spatial field in data</param>
    /// <returns>GeometryBase instance</returns>
    GeometryBase CreateGeometry(object dataItem, string geometryFieldName);




    /// <summary>
    /// when geometry is not available directly from IEnumerable, but is saved is structure for example,
    /// this function returns geometry data by given geometry field name
    /// </summary>
    /// <param name="dataItem">item from IEnumerable collection</param>
    /// <param name="geometryFieldIndex">index of geometry/spatial field in data</param>
    /// <returns>GeometryBase instance</returns>
    GeometryBase CreateGeometry(object dataItem, int geometryFieldIndex);




    /// <summary>
    /// function that converts <c>GeometryBase</c> back into
    /// particular storage format
    /// </summary>
    /// <param name="geometry">geometry object</param>
    /// <param name="geometryFieldName">name of geometry/spatial field in data</param>
    /// <returns>geometry converted to storage format</returns>
    object SaveGeometry(GeometryBase geometry, string geometryFieldName);




    /// <summary>
    /// function that converts <c>GeometryBase</c> back into
    /// particular storage format
    /// </summary>
    /// <param name="geometry">geometry object</param>
    /// <param name="geometryFieldIndex">index of geometry/spatial field in data</param>
    /// <returns>geometry converted to storage format</returns>
    object SaveGeometry(GeometryBase geometry, int geometryFieldIndex);

  }

}
